{# Insert flashes #}
<div class="toasts-global d-none">
    {% for label, messages in app.flashes() %}
        {% for message in messages %}
            {{ include('_toast.html.twig', {
                'label': label,
                'message': message
            }) }}
        {% endfor %}
    {% endfor %}
</div>

{# Allow pages to request a fully reload of everything #}
{% if global_reload_needed is defined and global_reload_needed %}
    <div {{ stimulus_controller('turbo/global_reload') }}></div>
{% endif %}

{# Insert info about when the sidebar trees were updated last time, so the sidebar_tree_controller can decide if it needs to reload the tree #}
<span id="sidebar-last-time-updated" style="display: none;" data-last-update="{{ sidebar_tree_updater.lastTreeUpdate.format("Y-m-d\\TH:i:sP") }}"></span>

{# The title block is already escaped, therefore we dont require any additional escaping here #}
<div class="d-none" data-title="{{ current_page_title|trim|raw }}" {{ stimulus_controller('turbo/title') }}></div>

<div class="d-none" {{ stimulus_controller('turbo/locale_menu') }}>
    {% set locales = settings_instance('localization').languageMenuEntries %}
    {% if locales is empty %}
        {% set locales = locale_menu %}
    {% endif %}

    {% for locale in locales %}
        <a class="dropdown-item" data-turbo="false" data-turbo-frame="_top" href="{{ path(app.request.attributes.get('_route'),
            app.request.query.all|merge(app.request.attributes.get('_route_params'))|merge({'_locale': locale})) }}">
            {{ locale|language_name }} ({{ locale|upper }})</a>
    {% endfor %}
</div>
